<!DOCTYPE html>
<html class="x-admin-sm">
    {include file="Admin/Public/head" title="友情链接" /}
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                    <input type="hidden" name="id"value="{$data['id']}">
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>网站名称
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="name" name="name" value="{$data['name']}" autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>网站链接
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="links" name="links" value="{$data['links']}" autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>有效期
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="expire" placeholder="yyyy-MM-dd" name="expire" value="{$data['expire']}" autocomplete="off" readonly class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>是否显示</label>
                        <div class="layui-input-inline">
                            <select name="display">
                                <option value="0" {if $data['display'] == 0}selected{/if}>显示</option>
                                <option value="1" {if $data['display'] == 1}selected{/if}>隐藏</option>
                            </select>
                        </div>
                    </div>
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" lay-filter="add" lay-submit="">
                          增加
                      </button>
                  </div>
              </form>
            </div>
        </div>
        <script>layui.use(['form', 'layer', 'laydate'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                laydate = layui.laydate,
                layer = layui.layer;
                laydate.render({
                    elem: '#expire',
                    type: 'date',
                    trigger : 'click',
                });
                //监听提交
                form.on('submit(add)', function(data) {
                    layer.load(2);
                    $.post("/admin/link/create", data.field, function(data){
                        layer.closeAll();
                        if (data.code == 200) {
                            layer.msg(data.msg, {time: 1500}, function(){
                                xadmin.close();
                                xadmin.father_reload();
                            })
                        } else if (data.code) {
                            layer.msg(data.msg)
                        }
                    })
                    return false;
                });

            });</script>
        <script>var _hmt = _hmt || []; (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();</script>
    </body>

</html>
